<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分解质因数</title>
</head>
<script>

    var num = Number(prompt("请输入数字，将进行分解质因数"));
    document.write("分解质因数结果："+num+"=")
    for(var i=2; i<=num; i++) {
        while(num%i==0) {
            num = num/i;
            document.write(i+" ")
        }
    }

    // for(var i=2; i<=num; i++) {
    //     while(num%i==0) {
    //         num=num/i
    //         document.write(i)
    //     }
    // }
</script>
<body>
    
</body>
</html>